home *** CD-ROM | disk | FTP | other *** search
/ Halting the Hacker - A P…uide to Computer Security / Halting the Hacker - A Practical Guide to Computer Security.iso / rfc / rfc1541.txt < prev    next >
Text File  |  1997-04-01  |  97KB  |  2,187 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. Network Working Group                                           R. Droms
  8. Request for Comments: 1541                           Bucknell University
  9. Obsoletes: 1531                                             October 1993
  10. Category: Standards Track
  11.  
  12.  
  13.                   Dynamic Host Configuration Protocol
  14.  
  15. Status of this memo
  16.  
  17.    This RFC specifies an Internet standards track protocol for the
  18.    Internet community, and requests discussion and suggestions for
  19.    improvements.  Please refer to the current edition of the "Internet
  20.    Official Protocol Standards" for the standardization state and status
  21.    of this protocol.  Distribution of this memo is unlimited.
  22.  
  23. Abstract
  24.  
  25.    The Dynamic Host Configuration Protocol (DHCP) provides a framework
  26.    for passing configuration information to hosts on a TCP/IP network.
  27.    DHCP is based on the Bootstrap Protocol (BOOTP) [7], adding the
  28.    capability of automatic allocation of reusable network addresses and
  29.    additional configuration options [19].  DHCP captures the behavior of
  30.    BOOTP relay agents [7, 23], and DHCP participants can interoperate
  31.    with BOOTP participants [9].  Due to some errors introduced into RFC
  32.    1531 in the editorial process, this memo is reissued as RFC 1541.
  33.  
  34.  
  35. Table of Contents
  36.  
  37.    1.  Introduction. . . . . . . . . . . . . . . . . . . . . . . . .  2
  38.    1.1 Related Work. . . . . . . . . . . . . . . . . . . . . . . . .  4
  39.    1.2 Problem definition and issues . . . . . . . . . . . . . . . .  4
  40.    1.3 Requirements. . . . . . . . . . . . . . . . . . . . . . . . .  5
  41.    1.4 Terminology . . . . . . . . . . . . . . . . . . . . . . . . .  6
  42.    1.5 Design goals. . . . . . . . . . . . . . . . . . . . . . . . .  6
  43.    2. Protocol Summary . . . . . . . . . . . . . . . . . . . . . . .  8
  44.    2.1 Configuration parameters repository . . . . . . . . . . . . . 10
  45.    2.2 Dynamic allocation of network addresses . . . . . . . . . . . 11
  46.    3. The Client-Server Protocol . . . . . . . . . . . . . . . . . . 11
  47.    3.1 Client-server interaction - allocating a network address. . . 12
  48.    3.2 Client-server interaction - reusing a  previously allocated
  49.        network address . . . . . . . . . . . . . . . . . . . . . . . 17
  50.    3.3 Interpretation and representation of time values. . . . . . . 19
  51.    3.4 Host parameters in DHCP . . . . . . . . . . . . . . . . . . . 19
  52.    3.5 Use of DHCP in clients with multiple interfaces . . . . . . . 20
  53.    3.6 When clients should use DHCP. . . . . . . . . . . . . . . . . 20
  54.    4. Specification of the DHCP client-server protocol . . . . . . . 21
  55.  
  56.  
  57.  
  58. Droms                                                           [Page 1]
  59.  
  60. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  61.  
  62.  
  63.    4.1 Constructing and sending DHCP messages. . . . . . . . . . . . 21
  64.    4.2 DHCP server administrative controls . . . . . . . . . . . . . 23
  65.    4.3 DHCP server behavior. . . . . . . . . . . . . . . . . . . . . 24
  66.    4.3.1 DHCPDISCOVER message. . . . . . . . . . . . . . . . . . . . 24
  67.    4.3.2 DHCPREQUEST message . . . . . . . . . . . . . . . . . . . . 27
  68.    4.3.3 DHCPDECLINE message . . . . . . . . . . . . . . . . . . . . 29
  69.    4.3.4 DHCPRELEASE message . . . . . . . . . . . . . . . . . . . . 29
  70.    4.4 DHCP client behavior. . . . . . . . . . . . . . . . . . . . . 29
  71.    4.4.1 Initialization and allocation of network address. . . . . . 29
  72.    4.4.2 Initialization with known network address . . . . . . . . . 33
  73.    4.4.3 Initialization with a known DHCP server address . . . . . . 34
  74.    4.4.4 Reacquisition and expiration. . . . . . . . . . . . . . . . 34
  75.    4.4.5 DHCPRELEASE . . . . . . . . . . . . . . . . . . . . . . . . 35
  76.    5. Acknowledgments. . . . . . . . . . . . . . . . . . . . . . . . 35
  77.    6. References . . . . . . . . . . . . . . . . . . . . . . . . . . 36
  78.    7. Security Considerations. . . . . . . . . . . . . . . . . . . . 37
  79.    8. Author's Address . . . . . . . . . . . . . . . . . . . . . . . 38
  80.    A. Host Configuration Parameters  . . . . . . . . . . . . . . . . 39
  81.  
  82. List of Figures
  83.  
  84.    1. Format of a DHCP message . . . . . . . . . . . . . . . . . . .  9
  85.    2. Format of the 'flags' field. . . . . . . . . . . . . . . . . . 10
  86.    3. Timeline diagram of messages exchanged between DHCP client and
  87.       servers when allocating a new network address. . . . . . . . . 15
  88.    4. Timeline diagram of messages exchanged between DHCP client and
  89.       servers when reusing a previously allocated network address. . 18
  90.    5. State-transition diagram for DHCP clients. . . . . . . . . . . 31
  91.  
  92. List of Tables
  93.  
  94.    1. Description of fields in a DHCP message. . . . . . . . . . . . 14
  95.    2. DHCP messages. . . . . . . . . . . . . . . . . . . . . . . . . 16
  96.    3. Fields and options used by DHCP servers. . . . . . . . . . . . 25
  97.    4. Fields and options used by DHCP clients. . . . . . . . . . . . 32
  98.  
  99. 1. Introduction
  100.  
  101.    The Dynamic Host Configuration Protocol (DHCP) provides configuration
  102.    parameters to Internet hosts.  DHCP consists of two components: a
  103.    protocol for delivering host-specific configuration parameters from a
  104.    DHCP server to a host and a mechanism for allocation of network
  105.    addresses to hosts.
  106.  
  107.    DHCP is built on a client-server model, where designated DHCP server
  108.    hosts allocate network addresses and deliver configuration parameters
  109.    to dynamically configured hosts.  Throughout the remainder of this
  110.    document, the term "server" refers to a host providing initialization
  111.  
  112.  
  113.  
  114. Droms                                                           [Page 2]
  115.  
  116. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  117.  
  118.  
  119.    parameters through DHCP, and the term "client" refers to a host
  120.    requesting initialization parameters from a DHCP server.
  121.  
  122.    A host should not act as a DHCP server unless explicitly configured
  123.    to do so by a system administrator.  The diversity of hardware and
  124.    protocol implementations in the Internet would preclude reliable
  125.    operation if random hosts were allowed to respond to DHCP requests.
  126.    For example, IP requires the setting of many parameters within the
  127.    protocol implementation software.  Because IP can be used on many
  128.    dissimilar kinds of network hardware, values for those parameters
  129.    cannot be guessed or assumed to have correct defaults.  Also,
  130.    distributed address allocation schemes depend on a polling/defense
  131.    mechanism for discovery of addresses that are already in use.  IP
  132.    hosts may not always be able to defend their network addresses, so
  133.    that such a distributed address allocation scheme cannot be
  134.    guaranteed to avoid allocation of duplicate network addresses.
  135.  
  136.    DHCP supports three mechanisms for IP address allocation.  In
  137.    "automatic allocation", DHCP assigns a permanent IP address to a
  138.    host.  In "dynamic allocation", DHCP assigns an IP address to a host
  139.    for a limited period of time (or until the host explicitly
  140.    relinquishes the address).  In "manual allocation", a host's IP
  141.    address is assigned by the network administrator, and DHCP is used
  142.    simply to convey the assigned address to the host.  A particular
  143.    network will use one or more of these mechanisms, depending on the
  144.    policies of the network administrator.
  145.  
  146.    Dynamic allocation is the only one of the three mechanisms that
  147.    allows automatic reuse of an address that is no longer needed by the
  148.    host to which it was assigned.  Thus, dynamic allocation is
  149.    particularly useful for assigning an address to a host that will be
  150.    connected to the network only temporarily or for sharing a limited
  151.    pool of IP addresses among a group of hosts that do not need
  152.    permanent IP addresses.  Dynamic allocation may also be a good choice
  153.    for assigning an IP address to a new host being permanently connected
  154.    to a network where IP addresses are sufficiently scarce that it is
  155.    important to reclaim them when old hosts are retired.  Manual
  156.    allocation allows DHCP to be used to eliminate the error-prone
  157.    process of manually configuring hosts with IP addresses in
  158.    environments where (for whatever reasons) it is desirable to manage
  159.    IP address assignment outside of the DHCP mechanisms.
  160.  
  161.    The format of DHCP messages is based on the format of BOOTP messages,
  162.    to capture the BOOTP relay agent behavior described as part of the
  163.    BOOTP specification [7, 23] and to allow interoperability of existing
  164.    BOOTP clients with DHCP servers.  Using BOOTP relaying agents
  165.    eliminates the necessity of having a DHCP server on each physical
  166.    network segment.
  167.  
  168.  
  169.  
  170. Droms                                                           [Page 3]
  171.  
  172. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  173.  
  174.  
  175. 1.1 Related Work
  176.  
  177.    There are several Internet protocols and related mechanisms that
  178.    address some parts of the dynamic host configuration problem.  The
  179.    Reverse Address Resolution Protocol (RARP) [10] (through the
  180.    extensions defined in the Dynamic RARP (DRARP) [5]) explicitly
  181.    addresses the problem of network address discovery, and includes an
  182.    automatic IP address assignment mechanism.  The Trivial File Transfer
  183.    Protocol (TFTP) [20] provides for transport of a boot image from a
  184.    boot server.  The Internet Control Message Protocol (ICMP) [16]
  185.    provides for informing hosts of additional routers via "ICMP
  186.    redirect" messages.  ICMP also can provide subnet mask information
  187.    through the "ICMP mask request" message and other information through
  188.    the (obsolete) "ICMP information request" message.  Hosts can locate
  189.    routers through the ICMP router discovery mechanism [8].
  190.  
  191.    BOOTP is a transport mechanism for a collection of configuration
  192.    information.  BOOTP is also extensible, and official extensions [17]
  193.    have been defined for several configuration parameters.  Morgan has
  194.    proposed extensions to BOOTP for dynamic IP address assignment [15].
  195.    The Network Information Protocol (NIP), used by the Athena project at
  196.    MIT, is a distributed mechanism for dynamic IP address assignment
  197.    [19].  The Resource Location Protocol RLP [1] provides for location
  198.    of higher level services.  Sun Microsystems diskless workstations use
  199.    a boot procedure that employs RARP, TFTP and an RPC mechanism called
  200.    "bootparams" to deliver configuration information and operating
  201.    system code to diskless hosts.  (Sun Microsystems, Sun Workstation
  202.    and SunOS are trademarks of Sun Microsystems, Inc.)  Some Sun
  203.    networks also use DRARP and an auto-installation mechanism to
  204.    automate the configuration of new hosts in an existing network.
  205.  
  206.    In other related work, the path minimum transmission unit (MTU)
  207.    discovery algorithm can determine the MTU of an arbitrary internet
  208.    path [14].  Comer and Droms have proposed the use of the Address
  209.    Resolution Protocol (ARP) as a transport protocol for resource
  210.    location and selection [6].  Finally, the Host Requirements RFCs [3,
  211.    4] mention specific requirements for host reconfiguration and suggest
  212.    a scenario for initial configuration of diskless hosts.
  213.  
  214. 1.2 Problem definition and issues
  215.  
  216.    DHCP is designed to supply hosts with the configuration parameters
  217.    defined in the Host Requirements RFCs.  After obtaining parameters
  218.    via DHCP, a host should be able to exchange packets with any other
  219.    host in the Internet.  The parameters supplied by DHCP are listed in
  220.    Appendix A.
  221.  
  222.  
  223.  
  224.  
  225.  
  226. Droms                                                           [Page 4]
  227.  
  228. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  229.  
  230.  
  231.    Not all of these parameters are required for a newly initialized
  232.    host.  A client and server may negotiate for the transmission of only
  233.    those parameters required by the client or specific to a particular
  234.    subnet.
  235.  
  236.    DHCP allows but does not require the configuration of host parameters
  237.    not directly related to the IP protocol.  DHCP also does not address
  238.    registration of newly configured hosts with the Domain Name System
  239.    (DNS) [12, 13].
  240.  
  241.    DHCP is not intended for use in configuring routers.
  242.  
  243. 1.3 Requirements
  244.  
  245.    Throughout this document, the words that are used to define the
  246.    significance of particular requirements are capitalized.  These words
  247.    are:
  248.  
  249.       o "MUST"
  250.  
  251.         This word or the adjective "REQUIRED" means that the
  252.         item is an absolute requirement of this specification.
  253.  
  254.       o "MUST NOT"
  255.  
  256.         This phrase means that the item is an absolute prohibition
  257.         of this specification.
  258.  
  259.       o "SHOULD"
  260.  
  261.         This word or the adjective "RECOMMENDED" means that there
  262.         may exist valid reasons in particular circumstances to ignore
  263.         this item, but the full implications should be understood and
  264.         the case carefully weighed before choosing a different course.
  265.  
  266.       o "SHOULD NOT"
  267.  
  268.         This phrase means that there may exist valid reasons in
  269.         particular circumstances when the listed behavior is acceptable
  270.         or even useful, but the full implications should be understood
  271.         and the case carefully weighed before implementing any behavior
  272.         described with this label.
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282. Droms                                                           [Page 5]
  283.  
  284. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  285.  
  286.  
  287.       o "MAY"
  288.  
  289.         This word or the adjective "OPTIONAL" means that this item is
  290.         truly optional.  One vendor may choose to include the item
  291.         because a particular marketplace requires it or because it
  292.         enhances the product, for example; another vendor may omit the
  293.         same item.
  294.  
  295. 1.4 Terminology
  296.  
  297.    This document uses the following terms:
  298.  
  299.       o "DHCP client"
  300.  
  301.         A DHCP client is an Internet host using DHCP to obtain
  302.         configuration parameters such as a network address.
  303.  
  304.       o "DHCP server"
  305.  
  306.         A DHCP server is an Internet host that returns configuration
  307.         parameters to DHCP clients.
  308.  
  309.       o "BOOTP relay agent"
  310.  
  311.         A BOOTP relay agent is an Internet host or router that passes
  312.         DHCP messages between DHCP clients and DHCP servers.  DHCP is
  313.         designed to use the same relay agent behavior as specified in
  314.         the BOOTP protocol specification.
  315.  
  316.       o "binding"
  317.  
  318.         A binding is a collection of configuration parameters, including
  319.         at least an IP address, associated with or "bound to" a DHCP
  320.         client.  Bindings are managed by DHCP servers.
  321.  
  322. 1.5 Design goals
  323.  
  324.    The following list gives general design goals for DHCP.
  325.  
  326.       o DHCP should be a mechanism rather than a policy.  DHCP must
  327.         allow local system administrators control over configuration
  328.         parameters where desired; e.g., local system administrators
  329.         should be able to enforce local policies concerning allocation
  330.         and access to local resources where desired.
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338. Droms                                                           [Page 6]
  339.  
  340. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  341.  
  342.  
  343.       o Hosts should require no manual configuration.  Each host should
  344.         be able to discover appropriate local configuration parameters
  345.         without user intervention and incorporate those parameters into
  346.         its own configuration.
  347.  
  348.       o Networks should require no hand configuration for individual
  349.         hosts.  Under normal circumstances, the network manager should
  350.         not have to enter any per-host configuration parameters.
  351.  
  352.       o DHCP should not require a server on each subnet.  To allow for
  353.         scale and economy, DHCP must work across routers or through the
  354.         intervention of BOOTP/DHCP relay agents.
  355.  
  356.       o A DHCP host must be prepared to receive multiple responses to a
  357.         request for configuration parameters.  Some installations may
  358.         include multiple, overlapping DHCP servers to enhance
  359.         reliability and increase performance.
  360.  
  361.       o DHCP must coexist with statically configured, non-participating
  362.         hosts and with existing network protocol implementations.
  363.  
  364.       o DHCP must interoperate with the BOOTP relay agent behavior as
  365.         described by RFC 951 and by Wimer [21].
  366.  
  367.       o DHCP must provide service to existing BOOTP clients.
  368.  
  369.    The following list gives design goals specific to the transmission of
  370.    the network layer parameters.  DHCP must:
  371.  
  372.       o Guarantee that any specific network address will not be in
  373.         use by more than one host at a time,
  374.  
  375.       o Retain host configuration across host reboot.  A host should,
  376.         whenever possible, be assigned the same configuration parameters
  377.         (e.g., network address) in response to each request,
  378.  
  379.       o Retain host configuration across server reboots, and, whenever
  380.         possible, a host should be assigned the same configuration
  381.         parameters despite restarts of the DHCP mechanism,
  382.  
  383.       o Allow automatic assignment of configuration parameters to new
  384.         hosts to avoid hand configuration for new hosts,
  385.  
  386.       o Support fixed or permanent allocation of configuration
  387.         parameters to specific hosts.
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394. Droms                                                           [Page 7]
  395.  
  396. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  397.  
  398.  
  399. 2. Protocol Summary
  400.  
  401.    From the client's point of view, DHCP is an extension of the BOOTP
  402.    mechanism.  This behavior allows existing BOOTP clients to
  403.    interoperate with DHCP servers without requiring any change to the
  404.    clients' initialization software.  A separate document details the
  405.    interactions between BOOTP and DHCP clients and servers [9].  There
  406.    are some new, optional transactions that optimize the interaction
  407.    between DHCP clients and servers that are described in sections 3 and
  408.    4.
  409.  
  410.    Figure 1 gives the format of a DHCP message and table 1 describes
  411.    each of the fields in the DHCP message.  The numbers in parentheses
  412.    indicate the size of each field in octets.  The names for the fields
  413.    given in the figure will be used throughout this document to refer to
  414.    the fields in DHCP messages.
  415.  
  416.    There are two primary differences between DHCP and BOOTP.  First,
  417.    DHCP defines mechanisms through which clients can be assigned a
  418.    network address for a fixed lease, allowing for serial reassignment
  419.    of network addresses to different clients.  Second, DHCP provides the
  420.    mechanism for a client to acquire all of the IP configuration
  421.    parameters that it needs in order to operate.
  422.  
  423.    DHCP introduces a small change in terminology intended to clarify the
  424.    meaning of one of the fields.  What was the "vendor extensions" field
  425.    in BOOTP has been re-named the "options" field in DHCP. Similarly,
  426.    the tagged data items that were used inside the BOOTP "vendor
  427.    extensions" field, which were formerly referred to as "vendor
  428.    extensions," are now termed simply "options."
  429.  
  430.    DHCP defines a new 'client identifier' option that is used to pass an
  431.    explicit client identifier to a DHCP server.  This change eliminates
  432.    the overloading of the 'chaddr' field in BOOTP messages, where
  433.    'chaddr' is used both as a hardware address for transmission of BOOTP
  434.    reply messages and as a client identifier.  The 'client identifier'
  435.    option may contain a hardware address, identical to the contents of
  436.    the 'chaddr' field, or it may contain another type of identifier,
  437.    such as a DNS name.  Other client identifier types may be defined as
  438.    needed for use with DHCP.  New client identifier types will be
  439.    registered with the IANA [18] and will be included in new revisions
  440.    of the Assigned Numbers document, as well as described in detail in
  441.    future revisions of the DHCP Options [2].
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450. Droms                                                           [Page 8]
  451.  
  452. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  453.  
  454.  
  455.    0                   1                   2                   3
  456.    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  457.    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  458.    |     op (1)    |   htype (1)   |   hlen (1)    |   hops (1)    |
  459.    +---------------+---------------+---------------+---------------+
  460.    |                            xid (4)                            |
  461.    +-------------------------------+-------------------------------+
  462.    |           secs (2)            |           flags (2)           |
  463.    +-------------------------------+-------------------------------+
  464.    |                          ciaddr  (4)                          |
  465.    +---------------------------------------------------------------+
  466.    |                          yiaddr  (4)                          |
  467.    +---------------------------------------------------------------+
  468.    |                          siaddr  (4)                          |
  469.    +---------------------------------------------------------------+
  470.    |                          giaddr  (4)                          |
  471.    +---------------------------------------------------------------+
  472.    |                                                               |
  473.    |                          chaddr  (16)                         |
  474.    |                                                               |
  475.    |                                                               |
  476.    +---------------------------------------------------------------+
  477.    |                                                               |
  478.    |                          sname   (64)                         |
  479.    +---------------------------------------------------------------+
  480.    |                                                               |
  481.    |                          file    (128)                        |
  482.    +---------------------------------------------------------------+
  483.    |                                                               |
  484.    |                          options (312)                        |
  485.    +---------------------------------------------------------------+
  486.  
  487.                   Figure 1:  Format of a DHCP message
  488.  
  489.    DHCP clarifies the interpretation of the 'siaddr' field as the
  490.    address of the server to use in the next step of the client's
  491.    bootstrap process.  A DHCP server may return its own address in the
  492.    'siaddr' field, if the server is prepared to supply the next
  493.    bootstrap service (e.g., delivery of an operating system executable
  494.    image).  A DHCP server always returns its own address in the 'server
  495.    identifier' option.
  496.  
  497.    The options field is now variable length, with the minimum extended
  498.    to 312 octets.  This brings the minimum size of a DHCP message up to
  499.    576 octets, the minimum IP datagram size a host must be prepared to
  500.    accept [3].  DHCP clients may negotiate the use of larger DHCP
  501.    messages through the 'Maximum DHCP message size' option.  The options
  502.    field may be further extended into the 'file' and 'sname' fields.
  503.  
  504.  
  505.  
  506. Droms                                                           [Page 9]
  507.  
  508. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  509.  
  510.  
  511.    A new option, called 'vendor specific information', has been added to
  512.    allow for expansion of the number of options that can be supported
  513.    [2].  Options encapsulated as 'vendor specific information' must be
  514.    carefully defined and documented so as to allow for interoperability
  515.    between clients and servers from diferent vendors.  In particular,
  516.    vendors defining 'vendor specific information' MUST document those
  517.    options in the form of the DHCP Options document, MUST choose to
  518.    represent those options either in data types already defined for DHCP
  519.    options or in other well-defined data types, and MUST choose options
  520.    that can be readily encoded in configuration files for exchange with
  521.    servers provided by other vendors.  Options included as 'vendor
  522.    specific options' MUST be readily supportable by all servers.
  523.  
  524.                                     1 1 1 1 1 1
  525.                 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
  526.                 -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  527.                 B|             MBZ             |
  528.                 -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  529.  
  530.                 B:  BROADCAST flag
  531.  
  532.                 MBZ:  MUST BE ZERO (reserved for future use)
  533.  
  534.                 Figure 2:  Format of the 'flags' field
  535.  
  536.    DHCP uses the 'flags' field [21].  The leftmost bit is defined as the
  537.    BROADCAST (B) flag.  The semantics of this flag are discussed in
  538.    section 4.1 of this document.  The remaining bits of the flags field
  539.    are reserved for future use.  They MUST be set to zero by clients and
  540.    ignored by servers and relay agents.  Figure 2 gives the format of
  541.    the 'flags' field.
  542.  
  543. 2.1 Configuration parameters repository
  544.  
  545.    The first service provided by DHCP is to provide persistent storage
  546.    of network parameters for network clients.  The model of DHCP
  547.    persistent storage is that the DHCP service stores a key-value entry
  548.    for each client, where the key is some unique identifier (for
  549.    example, an IP subnet number and a unique identifier within the
  550.    subnet) and the value contains the configuration parameters for the
  551.    client.
  552.  
  553.    For example, the key might be the pair (IP-subnet-number, hardware-
  554.    address), allowing for serial or concurrent reuse of a hardware
  555.    address on different subnets, and for hardware addresses that may not
  556.    be globally unique.  Alternately, the key might be the pair (IP-
  557.    subnet-number, hostname), allowing the server to assign parameters
  558.    intelligently to a host that has been moved to a different subnet or
  559.  
  560.  
  561.  
  562. Droms                                                          [Page 10]
  563.  
  564. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  565.  
  566.  
  567.    has changed hardware addresses (perhaps because the network interface
  568.    failed and was replaced).
  569.  
  570.    A client can query the DHCP service to retrieve its configuration
  571.    parameters.  The client interface to the configuration parameters
  572.    repository consists of protocol messages to request configuration
  573.    parameters and responses from the server carrying the configuration
  574.    parameters.
  575.  
  576. 2.2 Dynamic allocation of network addresses
  577.  
  578.    The second service provided by DHCP is the allocation of temporary or
  579.    permanent network (IP) addresses to hosts.  The basic mechanism for
  580.    the dynamic allocation of network addresses is simple: a client
  581.    requests the use of an address for some period of time.  The
  582.    allocation mechanism (the collection of DHCP servers) guarantees not
  583.    to reallocate that address within the requested time and attempts to
  584.    return the same network address each time the client requests an
  585.    address.  In this document, the period over which a network address
  586.    is allocated to a client is referred to as a "lease" [11].  The
  587.    client may extend its lease with subsequent requests.  The client may
  588.    issue a message to release the address back to the server when the
  589.    client no longer needs the address.  The client may ask for a
  590.    permanent assignment by asking for an infinite lease.  Even when
  591.    assigning "permanent" addresses, a server may choose to give out
  592.    lengthy but non-infinite leases to allow detection of the fact that
  593.    the host has been retired.
  594.  
  595.    In some environments it will be necessary to reassign network
  596.    addresses due to exhaustion of available addresses.  In such
  597.    environments, the allocation mechanism will reuse addresses whose
  598.    lease has expired.  The server should use whatever information is
  599.    available in the configuration information repository to choose an
  600.    address to reuse.  For example, the server may choose the least
  601.    recently assigned address.  As a consistency check, the allocation
  602.    mechanism may probe the reused address, e.g., with an ICMP echo
  603.    request, before allocating the address, and the client will probe the
  604.    newly received address, e.g., with ARP.
  605.  
  606. 3. The Client-Server Protocol
  607.  
  608.    DHCP uses the BOOTP message format defined in RFC 951 and given in
  609.    table 1 and figure 1.  The 'op' field of each DHCP message sent from
  610.    a client to a server contains BOOTREQUEST. BOOTREPLY is used in the
  611.    'op' field of each DHCP message sent from a server to a client.
  612.  
  613.    The first four octets of the 'options' field of the DHCP message
  614.    contain the (decimal) values 99, 130, 83 and 99, respectively (this
  615.  
  616.  
  617.  
  618. Droms                                                          [Page 11]
  619.  
  620. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  621.  
  622.  
  623.    is the same magic cookie as is defined in RFC 1497).  The remainder
  624.    of the 'options' field consists a list of tagged parameters that are
  625.    called "options".  All of the "vendor extensions" listed in RFC 1497
  626.    are also DHCP options.  A separate document gives the complete set of
  627.    options defined for use with DHCP [2].
  628.  
  629.    Several options have been defined so far.  One particular option -
  630.    the "DHCP message type" option - must be included in every DHCP
  631.    message.  This option defines the "type" of the DHCP message.
  632.    Additional options may be allowed, required, or not allowed,
  633.    depending on the DHCP message type.
  634.  
  635.    Throughout this document, DHCP messages that include a 'DHCP message
  636.    type' option will be referred to by the type of the message; e.g., a
  637.    DHCP message with 'DHCP message type' option type 1 will be referred
  638.    to as a "DHCPDISCOVER" message.
  639.  
  640. 3.1 Client-server interaction - allocating a network address
  641.  
  642.    The following summary of the protocol exchanges between clients and
  643.    servers refers to the DHCP messages described in table 2.  The
  644.    timeline diagram in figure 3 shows the timing relationships in a
  645.    typical client-server interaction.  If the client already knows its
  646.    address, some steps may be omitted; this abbreviated interaction is
  647.    described in section 3.2.
  648.  
  649.    1. The client broadcasts a DHCPDISCOVER message on its local physical
  650.       subnet.  The DHCPDISCOVER message may include options that suggest
  651.       values for the network address and lease duration.  BOOTP relay
  652.       agents may pass the message on to DHCP servers not on the same
  653.       physical subnet.
  654.  
  655.    2. Each server may respond with a DHCPOFFER message that includes an
  656.       available network address in the 'yiaddr' field (and other
  657.       configuration parameters in DHCP options).  Servers need not
  658.       reserve the offered network address, although the protocol will
  659.       work more efficiently if the server avoids allocating the offered
  660.       network address to another client.  The server unicasts the
  661.       DHCPOFFER message to the client (using the DHCP/BOOTP relay agent
  662.       if necessary) if possible, or may broadcast the message to a
  663.       broadcast address (preferably 255.255.255.255) on the client's
  664.       subnet.
  665.  
  666.    3. The client receives one or more DHCPOFFER messages from one or
  667.       more servers.  The client may choose to wait for multiple
  668.       responses.  The client chooses one server from which to request
  669.       configuration parameters, based on the configuration parameters
  670.       offered in the DHCPOFFER messages.  The client broadcasts a
  671.  
  672.  
  673.  
  674. Droms                                                          [Page 12]
  675.  
  676. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  677.  
  678.  
  679.       DHCPREQUEST message that MUST include the 'server identifier'
  680.       option to indicate which server it has selected, and may include
  681.       other options specifying desired configuration values.  This
  682.       DHCPREQUEST message is broadcast and relayed through DHCP/BOOTP
  683.       relay agents.  To help ensure that any DHCP/BOOTP relay agents
  684.       forward the DHCPREQUEST message to the same set of DHCP servers
  685.       that received the original DHCPDISCOVER message, the DHCPREQUEST
  686.       message must use the same value in the DHCP message header's
  687.       'secs' field and be sent to the same IP broadcast address as the
  688.       original DHCPDISCOVER message.  The client times out and
  689.       retransmits the DHCPDISCOVER message if the client receives no
  690.       DHCPOFFER messages.
  691.  
  692.    4. The servers receive the DHCPREQUEST broadcast from the client.
  693.       Those servers not selected by the DHCPREQUEST message use the
  694.       message as notification that the client has declined that server's
  695.       offer.  The server selected in the DHCPREQUEST message commits the
  696.       binding for the client to persistent storage and responds with a
  697.       DHCPACK message containing the configuration parameters for the
  698.       requesting client.  The combination of 'chaddr' and assigned
  699.       network address constitute an unique identifier for the client's
  700.       lease and are used by both the client and server to identify a
  701.       lease referred to in any DHCP messages.  The 'yiaddr' field in the
  702.       DHCPACK messages is filled in with the selected network address.
  703.  
  704.       If the selected server is unable to satisfy the DHCPREQUEST message
  705.       (e.g., the requested network address has been allocated), the
  706.       server SHOULD respond with a DHCPNAK message.
  707.  
  708.       A server may choose to mark addresses offered to clients in
  709.       DHCPOFFER messages as unavailable.  The server should mark an
  710.       address offered to a client in a DHCPOFFER message as available if
  711.       the server receives no DHCPREQUEST message from that client.
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730. Droms                                                          [Page 13]
  731.  
  732. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  733.  
  734.  
  735.    FIELD      OCTETS       DESCRIPTION
  736.    -----      ------       -----------
  737.  
  738.    op            1  Message op code / message type.
  739.                     1 = BOOTREQUEST, 2 = BOOTREPLY
  740.    htype         1  Hardware address type, see ARP section in "Assigned
  741.                     Numbers" RFC; e.g., '1' = 10mb ethernet.
  742.    hlen          1  Hardware address length (e.g.  '6' for 10mb
  743.                     ethernet).
  744.    hops          1  Client sets to zero, optionally used by relay-agents
  745.                     when booting via a relay-agent.
  746.    xid           4  Transaction ID, a random number chosen by the
  747.                     client, used by the client and server to associate
  748.                     messages and responses between a client and a
  749.                     server.
  750.    secs          2  Filled in by client, seconds elapsed since client
  751.                     started trying to boot.
  752.    flags         2  Flags (see figure 2).
  753.    ciaddr        4  Client IP address; filled in by client in
  754.                     DHCPREQUEST if verifying previously allocated
  755.                     configuration parameters.
  756.    yiaddr        4  'your' (client) IP address.
  757.    siaddr        4  IP address of next server to use in bootstrap;
  758.                     returned in DHCPOFFER, DHCPACK and DHCPNAK by
  759.                     server.
  760.    giaddr        4  Relay agent IP address, used in booting via a
  761.                     relay-agent.
  762.    chaddr       16  Client hardware address.
  763.    sname        64  Optional server host name, null terminated string.
  764.    file        128  Boot file name, null terminated string; "generic"
  765.                     name or null in DHCPDISCOVER, fully qualified
  766.                     directory-path name in DHCPOFFER.
  767.    options     312  Optional parameters field.  See the options
  768.                     documents for a list of defined options.
  769.  
  770.              Table 1:  Description of fields in a DHCP message
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786. Droms                                                          [Page 14]
  787.  
  788. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  789.  
  790.  
  791.                 Server          Client          Server
  792.             (not selected)                    (selected)
  793.  
  794.                   v               v               v
  795.                   |               |               |
  796.                   |     Begins initialization     |
  797.                   |               |               |
  798.                   | _____________/|\_____________ |
  799.                   |/ DHCPDISCOVER | DHCPDISCOVER \|
  800.                   |               |               |
  801.               Determines          |          Determines
  802.              configuration        |         configuration
  803.                   |               |               |
  804.                   |\              |  ____________/|
  805.                   | \_________    | /DHCPOFFER    |
  806.                   |  DHCPOFFER\   |/              |
  807.                   |            \  |               |
  808.                   |       Collects replies        |
  809.                   |              \|               |
  810.                   |     Selects configuration     |
  811.                   |               |               |
  812.                   | _____________/|\_____________ |
  813.                   |/ DHCPREQUEST  |  DHCPREQUEST \|
  814.                   |               |               |
  815.                   |               |     Commits configuration
  816.                   |               |               |
  817.                   |               | _____________/|
  818.                   |               |/ DHCPACK      |
  819.                   |               |               |
  820.                   |    Initialization complete    |
  821.                   |               |               |
  822.                   .               .               .
  823.                   .               .               .
  824.                   |               |               |
  825.                   |      Graceful shutdown        |
  826.                   |               |               |
  827.                   |               |\_____________ |
  828.                   |               |  DHCPRELEASE \|
  829.                   |               |               |
  830.                   |               |        Discards lease
  831.                   |               |               |
  832.                   v               v               v
  833.  
  834.      Figure 3: Timeline diagram of messages exchanged between DHCP
  835.                client and servers when allocating a new network address
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842. Droms                                                          [Page 15]
  843.  
  844. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  845.  
  846.  
  847.    Message         Use
  848.    -------         ---
  849.  
  850.    DHCPDISCOVER -  Client broadcast to locate available servers.
  851.  
  852.    DHCPOFFER    -  Server to client in response to DHCPDISCOVER with
  853.                    offer of configuration parameters.
  854.  
  855.    DHCPREQUEST  -  Client broadcast to servers requesting offered
  856.                    parameters from one server and implicitly declining
  857.                    offers from all others.
  858.  
  859.    DHCPACK      -  Server to client with configuration parameters,
  860.                    including committed network address.
  861.  
  862.    DHCPNAK      -  Server to client refusing request for configuration
  863.                    parameters (e.g., requested network address already
  864.                    allocated).
  865.  
  866.    DHCPDECLINE  -  Client to server indicating configuration parameters
  867.                    (e.g., network address) invalid.
  868.  
  869.    DHCPRELEASE  -  Client to server relinquishing network address and
  870.                    cancelling remaining lease.
  871.  
  872.                           Table 2:  DHCP messages
  873.  
  874.    5. The client receives the DHCPACK message with configuration
  875.       parameters.  The client performs a final check on the parameters
  876.       (e.g., ARP for allocated network address), and notes the duration
  877.       of the lease and the lease identification cookie specified in the
  878.       DHCPACK message.  At this point, the client is configured.  If the
  879.       client detects a problem with the parameters in the DHCPACK
  880.       message, the client sends a DHCPDECLINE message to the server and
  881.       restarts the configuration process.  The client should wait a
  882.       minimum of ten seconds before restarting the configuration process
  883.       to avoid excessive network traffic in case of looping.
  884.  
  885.       If the client receives a DHCPNAK message, the client restarts the
  886.       configuration process.
  887.  
  888.       The client times out and retransmits the DHCPREQUEST message if the
  889.       client receives neither a DHCPACK or a DHCPNAK message.  The client
  890.       retransmits the DHCPREQUEST according to the retransmission
  891.       algorithm in section 4.1.  If the client receives neither a DHCPACK
  892.       or a DHCPNAK message after ten retransmissions of the DHCPREQUEST
  893.       message, the client reverts to INIT state and restarts the
  894.       initialization process.  The client SHOULD notify the user that the
  895.  
  896.  
  897.  
  898. Droms                                                          [Page 16]
  899.  
  900. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  901.  
  902.  
  903.       initialization process has failed and is restarting.
  904.  
  905.    6. The client may choose to relinquish its lease on a network address
  906.       by sending a DHCPRELEASE message to the server.  The client
  907.       identifies the lease to be released by including its network
  908.       address in the 'ciaddr' field and its hardware address in the
  909.       'chaddr' field.
  910.  
  911. 3.2 Client-server interaction - reusing a previously allocated network
  912.     address
  913.  
  914.    If a client remembers and wishes to reuse a previously allocated
  915.    network address (allocated either by DHCP or some means outside the
  916.    protocol), a client may choose to omit some of the steps described in
  917.    the previous section.  The timeline diagram in figure 4 shows the
  918.    timing relationships in a typical client-server interaction for a
  919.    client reusing a previously allocated network address.
  920.  
  921.       1. The client broadcasts a DHCPREQUEST message on its local subnet.
  922.          The DHCPREQUEST message includes the client's network address in
  923.          the 'ciaddr' field.  DHCP/BOOTP relay agents pass the message on
  924.          to DHCP servers not on the same subnet.
  925.  
  926.       2. Servers with knowledge of the client's configuration parameters
  927.          respond with a DHCPACK message to the client.
  928.  
  929.          If the client's request is invalid (e.g., the client has moved
  930.          to a new subnet), servers may respond with a DHCPNAK message to
  931.          the client.
  932.  
  933.       3. The client receives the DHCPACK message with configuration
  934.          prameters.  The client performs a final check on the parameters
  935.          (as in section 3.1), and notes the duration of the lease and
  936.          the lease identification cookie specified in the DHCPACK
  937.          message.  At this point, the client is configured.
  938.  
  939.          If the client detects a problem with the parameters in the
  940.          DHCPACK message, the client sends a DHCPDECLINE message to the
  941.          server and restarts the configuration process by requesting a
  942.          new network address.  This action corresponds to the client
  943.          moving to the INIT state in the DHCP state diagram, which is
  944.          described in section 4.4.
  945.  
  946.  
  947.  
  948.  
  949.  
  950.  
  951.  
  952.  
  953.  
  954. Droms                                                          [Page 17]
  955.  
  956. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  957.  
  958.  
  959.                 Server          Client          Server
  960.  
  961.                   v               v               v
  962.                   |               |               |
  963.                   |             Begins            |
  964.                   |         initialization        |
  965.                   |               |               |
  966.                   |              /|\              |
  967.                   |  ___________/ | \___________  |
  968.                   | /DHCPREQUEST  |  DHCPREQUEST\ |
  969.                   |/              |              \|
  970.                   |               |               |
  971.                Locates            |            Locates
  972.             configuration         |         configuration
  973.                   |               |               |
  974.                   |\              |              /|
  975.                   | \             |  ___________/ |
  976.                   |  \            | /  DHCPACK    |
  977.                   |   \_______    |/              |
  978.                   |    DHCPACK\   |               |
  979.                   |         Initialization        |
  980.                   |            complete           |
  981.                   |              \|               |
  982.                   |               |               |
  983.                   |          (Subsequent          |
  984.                   |            DHCPACKS           |
  985.                   |            ignored)           |
  986.                   |               |               |
  987.                   |               |               |
  988.                   v               v               v
  989.  
  990.      Figure 4: Timeline diagram of messages exchanged between DHCP
  991.                client and servers when reusing a previously allocated
  992.                network address
  993.  
  994.          If the client receives a DHCPNAK message, it cannot reuse its
  995.          remembered network address.  It must instead request a new
  996.          address by restarting the configuration process, this time
  997.          using the (non-abbreviated) procedure described in section
  998.          3.1.  This action also corresponds to the client moving to
  999.          the INIT state in the DHCP state diagram.
  1000.  
  1001.          The client times out and retransmits the DHCPREQUEST message if
  1002.          the client receives neither a DHCPACK nor a DHCPNAK message.
  1003.          The   time between retransmission MUST be chosen according to
  1004.          the algorithm given in section 4.1.  If the client receives no
  1005.          answer after transmitting 4 DHCPREQUEST messages, the client
  1006.          MAY choose to use the previously allocated network address and
  1007.  
  1008.  
  1009.  
  1010. Droms                                                          [Page 18]
  1011.  
  1012. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  1013.  
  1014.  
  1015.          configuration parameters for the remainder of the unexpired
  1016.          lease.  This corresponds to moving to BOUND state in the client
  1017.          state transition diagram shown in figure 5.
  1018.  
  1019.       4. The client may choose to relinquish its lease on a network
  1020.          address by sending a DHCPRELEASE message to the server.  The
  1021.          client identifies the lease to be released with the lease
  1022.          identification cookie.
  1023.  
  1024.          Note that in this case, where the client retains its network
  1025.          address locally, the client will not normally relinquish its
  1026.          lease during a graceful shutdown.  Only in the case where the
  1027.          client explicitly needs to relinquish its lease, e.g., the client
  1028.          is about to be moved to a different subnet, will the client send
  1029.          a DHCPRELEASE message.
  1030.  
  1031. 3.3 Interpretation and representation of time values
  1032.  
  1033.    A client acquires a lease for a network address for a fixed period of
  1034.    time (which may be infinite).  Throughout the protocol, times are to
  1035.    be represented in units of seconds.  The time value of 0xffffffff is
  1036.    reserved to represent "infinity".  The minimum lease duration is one
  1037.    hour.
  1038.  
  1039.    As clients and servers may not have synchronized clocks, times are
  1040.    represented in DHCP messages as relative times, to be interpreted
  1041.    with respect to the client's local clock.  Representing relative
  1042.    times in units of seconds in an unsigned 32 bit word gives a range of
  1043.    relative times from 0 to approximately 100 years, which is sufficient
  1044.    for the relative times to be measured using DHCP.
  1045.  
  1046.    The algorithm for lease duration interpretation given in the previous
  1047.    paragraph assumes that client and server clocks are stable relative
  1048.    to each other.  If there is drift between the two clocks, the server
  1049.    may consider the lease expired before the client does.  To
  1050.    compensate, the server may return a shorter lease duration to the
  1051.    client than the server commits to its local database of client
  1052.    information.
  1053.  
  1054. 3.4 Host parameters in DHCP
  1055.  
  1056.    Not all clients require initialization of all parameters listed in
  1057.    Appendix A.  Two techniques are used to reduce the number of
  1058.    parameters transmitted from the server to the client.  First, most of
  1059.    the parameters have defaults defined in the Host Requirements RFCs;
  1060.    if the client receives no parameters from the server that override
  1061.    the defaults, a client uses those default values.  Second, in its
  1062.    initial DHCPDISCOVER or DHCPREQUEST message, a client may provide the
  1063.  
  1064.  
  1065.  
  1066. Droms                                                          [Page 19]
  1067.  
  1068. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  1069.  
  1070.  
  1071.    server with a list of specific parameters the client is interested
  1072.    in.
  1073.  
  1074.    The client SHOULD include the 'maximum DHCP message size' option to
  1075.    let the server know how large the server may make its DHCP messages.
  1076.    The parameters returned to a client may still exceed the space
  1077.    allocated to options in a DHCP message.  In this case, two additional
  1078.    options flags (which must appear in the 'options' field of the
  1079.    message) indicate that the 'file' and 'sname' fields are to be used
  1080.    for options.
  1081.  
  1082.    The client can inform the server which configuration parameters the
  1083.    client is interested in by including the 'parameter request list'
  1084.    option.  The data portion of this option explicitly lists the options
  1085.    requested by tag number.
  1086.  
  1087.    In addition, the client may suggest values for the network address
  1088.    and lease time in the DHCPDISCOVER message.  The client may include
  1089.    the 'requested IP address' option to suggest that a particular IP
  1090.    address be assigned, and may include the 'IP address lease time'
  1091.    option to suggest the lease time it would like.  No other options
  1092.    representing "hints" at configuration parameters are allowed in a
  1093.    DHCPDISCOVER or DHCPREQUEST message.  The 'ciaddr' field is to be
  1094.    filled in only in a DHCPREQUEST message when the client is requesting
  1095.    use of a previously allocated IP address.
  1096.  
  1097.    If a server receives a DHCPREQUEST message with an invalid 'ciaddr',
  1098.    the server SHOULD respond to the client with a DHCPNAK message and
  1099.    may choose to report the problem to the system administrator.  The
  1100.    server may include an error message in the 'message' option.
  1101.  
  1102. 3.5 Use of DHCP in clients with multiple interfaces
  1103.  
  1104.    A host with multiple network interfaces must use DHCP through each
  1105.    interface independently to obtain configuration information
  1106.    parameters for those separate interfaces.
  1107.  
  1108. 3.6 When clients should use DHCP
  1109.  
  1110.    A host should use DHCP to reacquire or verify its IP address and
  1111.    network parameters whenever the local network parameters may have
  1112.    changed; e.g., at system boot time or after a disconnection from the
  1113.    local network, as the local network configuration may change without
  1114.    the host's or user's knowledge.
  1115.  
  1116.    If a host has knowledge of a previous network address and is unable
  1117.    to contact a local DHCP server, the host may continue to use the
  1118.    previous network address until the lease for that address expires.
  1119.  
  1120.  
  1121.  
  1122. Droms                                                          [Page 20]
  1123.  
  1124. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  1125.  
  1126.  
  1127.    If the lease expires before the host can contact a DHCP server, the
  1128.    host must immediately discontinue use of the previous network address
  1129.    and may inform local users of the problem.
  1130.  
  1131. 4. Specification of the DHCP client-server protocol
  1132.  
  1133.    In this section, we assume that a DHCP server has a block of network
  1134.    addresses from which it can satisfy requests for new addresses.  Each
  1135.    server also maintains a database of allocated addresses and leases in
  1136.    local permanent storage.
  1137.  
  1138. 4.1 Constructing and sending DHCP messages
  1139.  
  1140.    DHCP clients and servers both construct DHCP messages by filling in
  1141.    fields in the fixed format section of the message and appending
  1142.    tagged data items in the variable length option area.  The options
  1143.    area includes first a four-octet 'magic cookie' (which was described
  1144.    in section 3), followed by the options.  The last option must always
  1145.    be the 'end' option.
  1146.  
  1147.    DHCP uses UDP as its transport protocol.  DHCP messages from a client
  1148.    to a server are sent to the 'DHCP server' port (67), and DHCP
  1149.    messages from a server to a client are sent to the 'DHCP client' port
  1150.    (68).
  1151.  
  1152.    DHCP messages broadcast by a client prior to that client obtaining
  1153.    its IP address must have the source address field in the IP header
  1154.    set to 0.
  1155.  
  1156.    If the 'giaddr' field in a DHCP message from a client is non-zero,
  1157.    the server sends any return messages to the 'DHCP server' port on the
  1158.    DHCP relaying agent whose address appears in 'giaddr'.  If the
  1159.    'giaddr' field is zero, the client is on the same subnet, and the
  1160.    server sends any return messages to either the client's network
  1161.    address, if that address was supplied in the 'ciaddr' field, or to
  1162.    the client's hardware address or to the local subnet broadcast
  1163.    address.
  1164.  
  1165.    If the options in a DHCP message extend into the 'sname' and 'file'
  1166.    fields, the 'option overload' option MUST appear in the 'options'
  1167.    field, with value 1, 2 or 3, as specified in the DHCP options
  1168.    document [2].  If the 'option overload' option is present in the
  1169.    'options' field, the options in the 'options' field MUST be
  1170.    terminated by an 'end' option, and MAY contain one or more 'pad'
  1171.    options to fill the options field.  The options in the 'sname' and
  1172.    'file' fields (if in use as indicated by the 'options overload'
  1173.    option) MUST begin with the first octet of the field, MUST be
  1174.    terminated by an 'end' option, and MUST be followed by 'pad' options
  1175.  
  1176.  
  1177.  
  1178. Droms                                                          [Page 21]
  1179.  
  1180. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  1181.  
  1182.  
  1183.    to fill the remainder of the field.  Any individual option in the
  1184.    'options', 'sname' and 'file' fields MUST be entirely contained in
  1185.    that field.  The options in the 'options' field MUST be interpreted
  1186.    first, so that any 'option overload' options may be interpreted.  The
  1187.    'file' field MUST be interpreted next (if the 'option overload'
  1188.    option indicates that the 'file' field contains DHCP options),
  1189.    followed by the 'sname' field.
  1190.  
  1191.    DHCP clients are responsible for all message retransmission.  The
  1192.    client MUST adopt a retransmission strategy that incorporates a
  1193.    randomized exponential backoff algorithm to determine the delay
  1194.    between retransmissions.  The delay before the first retransmission
  1195.    MUST be 4 seconds randomized by the value of a uniform random number
  1196.    chosen from the range -1 to +1.  Clients with clocks that provide
  1197.    resolution granularity of less than one second may choose a non-
  1198.    integer randomization value.  The delay before the next
  1199.    retransmission MUST be 8 seconds randomized by the value of a uniform
  1200.    number chosen from the range -1 to +1.  The retransmission delay MUST
  1201.    be doubled with subsequent retransmissions up to a maximum of 64
  1202.    seconds.  The client MAY provide an indication of retransmission
  1203.    attempts to the user as an indication of the progress of the
  1204.    configuration process.  The protocol specification in the remainder
  1205.    of this section will describe, for each DHCP message, when it is
  1206.    appropriate for the client to retransmit that message forever, and
  1207.    when it is appropriate for a client to abandon that message and
  1208.    attempt to use a different DHCP message.
  1209.  
  1210.    Normally, DHCP servers and BOOTP relay agents attempt to deliver
  1211.    DHCPOFFER, DHCPACK and DHCPNAK messages directly to the client using
  1212.    unicast delivery.  The IP destination address (in the IP header) is
  1213.    set to the DHCP 'yiaddr' address and the link-layer destination
  1214.    address is set to the DHCP 'chaddr' address.  Unfortunately, some
  1215.    client implementations are unable to receive such unicast IP
  1216.    datagrams until the implementation has been configured with a valid
  1217.    IP address (leading to a deadlock in which the client's IP address
  1218.    cannot be delivered until the client has been configured with an IP
  1219.    address).
  1220.  
  1221.    A client that cannot receive unicast IP datagrams until its protocol
  1222.    software has been configured with an IP address SHOULD set the
  1223.    BROADCAST bit in the 'flags' field to 1 in any DHCPDISCOVER or
  1224.    DHCPREQUEST messages that client sends.  The BROADCAST bit will
  1225.    provide a hint to the DHCP server and BOOTP relay agent to broadcast
  1226.    any messages to the client on the client's subnet.  A client that can
  1227.    receive unicast IP datagrams before its protocol software has been
  1228.    configured SHOULD clear the BROADCAST bit to 0.  The BOOTP
  1229.    clarifications document discusses the ramifications of the use of the
  1230.    BROADCAST bit [21].
  1231.  
  1232.  
  1233.  
  1234. Droms                                                          [Page 22]
  1235.  
  1236. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  1237.  
  1238.  
  1239.    A server or relay agent sending or relaying a DHCP message directly
  1240.    to a DHCP client (i.e., not to a relay agent specified in the
  1241.    'giaddr' field) SHOULD examine the BROADCAST bit in the 'flags'
  1242.    field.  If this bit is set to 1, the DHCP message SHOULD be sent as
  1243.    an IP broadcast using an IP broadcast address (preferably
  1244.    255.255.255.255) as the IP destination address and the link-layer
  1245.    broadcast address as the link-layer destination address.  If the
  1246.    BROADCAST bit is cleared to 0, the message SHOULD be sent as an IP
  1247.    unicast to the IP address specified in the 'yiaddr' field and the
  1248.    link-layer address specified in the 'chaddr' field.  If unicasting is
  1249.    not possible, the message MAY be sent as an IP broadcast using an IP
  1250.    broadcast address (preferably 255.255.255.255) as the IP destination
  1251.    address and the link-layer broadcast address as the link-layer
  1252.    destination address.
  1253.  
  1254. 4.2 DHCP server administrative controls
  1255.  
  1256.    DHCP servers are not required to respond to every DHCPDISCOVER and
  1257.    DHCPREQUEST message they receive.  For example, a network
  1258.    administrator, to retain stringent control over the hosts attached to
  1259.    the network, may choose to configure DHCP servers to respond only to
  1260.    hosts that have been previously registered through some external
  1261.    mechanism.  The DHCP specification describes only the interactions
  1262.    between clients and servers when the clients and servers choose to
  1263.    interact; it is beyond the scope of the DHCP specification to
  1264.    describe all of the administrative controls that system
  1265.    administrators might want to use.  Specific DHCP server
  1266.    implementations may incorporate any controls or policies desired by a
  1267.    network administrator.
  1268.  
  1269.    In some environments, a DHCP server will have to consider the values
  1270.    of the 'chaddr' field and/or the 'class-identifier' option included
  1271.    in the DHCPDISCOVER or DHCPREQUEST messages when determining the
  1272.    correct parameters for a particular client.  For example, an
  1273.    organization might have a separate bootstrap server for each type of
  1274.    client it uses, requiring the DHCP server to examine the 'class-
  1275.    identifier' to determine which bootstrap server address to return in
  1276.    the 'siaddr' field of a DHCPOFFER or DHCPACK message.
  1277.  
  1278.    A DHCP server must use some unique identifier to associate a client
  1279.    with its lease.  The client may choose to explicitly provide the
  1280.    identifier through the 'client identifier' option.  If the client
  1281.    does not provide a 'client identifier' option, the server MUST use
  1282.    the contents of the 'chaddr' field to identify the client.
  1283.  
  1284.    DHCP clients are free to use any strategy in selecting a DHCP server
  1285.    among those from which the client receives a DHCPOFFER message.  The
  1286.    client implementation of DHCP should provide a mechanism for the user
  1287.  
  1288.  
  1289.  
  1290. Droms                                                          [Page 23]
  1291.  
  1292. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  1293.  
  1294.  
  1295.    to select directly the 'class-identifier' value.
  1296.  
  1297. 4.3 DHCP server behavior
  1298.  
  1299.    A DHCP server processes incoming DHCP messages from a client based on
  1300.    the current state of the binding for that client.  A DHCP server can
  1301.    receive the following messages from a client:
  1302.  
  1303.       o DHCPDISCOVER
  1304.  
  1305.       o DHCPREQUEST
  1306.  
  1307.       o DHCPDECLINE
  1308.  
  1309.       o DHCPRELEASE
  1310.  
  1311.    Table 3 gives the use of the fields and options in a DHCP message by
  1312.    a server.  The remainder of this section describes the action of the
  1313.    DHCP server for each possible incoming message.
  1314.  
  1315. 4.3.1 DHCPDISCOVER message
  1316.  
  1317.    When a server receives a DHCPDISCOVER message from a client, the
  1318.    server chooses a network address for the requesting client.  If no
  1319.    address is available, the server may choose to report the problem to
  1320.    the system administrator and may choose to reply to the client with a
  1321.    DHCPNAK message.  If the server chooses to respond to the client, it
  1322.    may include an error message in the 'message' option.  If an address
  1323.    is available, the new address should be chosen as follows:
  1324.  
  1325.    o The client's previous address as recorded in the client's binding,
  1326.      if that address is in the server's pool of available addresses and
  1327.      not already allocated, else
  1328.  
  1329.    o The address requested in the 'Requested IP Address' option, if that
  1330.      address is valid and not already allocated, else
  1331.  
  1332.    o A new address allocated from the server's pool of available
  1333.      addresses.
  1334.  
  1335.  
  1336.  
  1337.  
  1338.  
  1339.  
  1340.  
  1341.  
  1342.  
  1343.  
  1344.  
  1345.  
  1346. Droms                                                          [Page 24]
  1347.  
  1348. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  1349.  
  1350.  
  1351.   Field      DHCPOFFER            DHCPACK             DHCPNAK
  1352.   -----      ---------            -------             -------
  1353.  
  1354.   'op'       BOOTREPLY            BOOTREPLY           BOOTREPLY
  1355.   'htype'    (From "Assigned Numbers" RFC)
  1356.   'hlen'     (Hardware address length in octets)
  1357.   'hops'     0                    0                   0
  1358.   'xid'      'xid' from client    'xid' from client   'xid' from client
  1359.              DHCPDISCOVER         DHCPREQUEST         DHCPREQUEST
  1360.              message              message             message
  1361.   'secs'     0                    0                   0
  1362.   'ciaddr'   0                    'ciaddr' from       'ciaddr' from
  1363.                                   DHCPREQUEST or 0    DHCPREQUEST or 0
  1364.   'yiaddr'   IP address offered   IP address          0
  1365.              to client            assigned to client
  1366.   'siaddr'   IP address of next   IP address of next  0
  1367.              bootstrap server     bootstrap server
  1368.   'flags'    if 'giaddr' is not 0 then 'flags' from client message else 0
  1369.   'giaddr'   0                    0                   0
  1370.   'chaddr'   'chaddr' from        'chaddr' from       'chaddr' from
  1371.              client               client DHCPREQUEST  client DHCPREQUEST
  1372.              DHCPDISCOVER         message             message
  1373.              message
  1374.   'sname'    Server host name     Server host name    (unused)
  1375.              or options           or options
  1376.   'file'     Client boot file     Client boot file    (unused)
  1377.              name or options      name or options
  1378.   'options'  options              options
  1379.  
  1380.   Option                   DHCPOFFER        DHCPACK          DHCPNAK
  1381.   ------                   ---------        -------          -------
  1382.  
  1383.   Requested IP address     MUST NOT         MUST NOT         MUST NOT
  1384.   IP address lease time    MUST             MUST             MUST NOT
  1385.   Use 'file'/'sname'       MAY              MAY              MUST NOT
  1386.   fields
  1387.   DHCP message type        DHCPOFFER        DHCPACK          DHCPNAK
  1388.   Parameter request list   MUST NOT         MUST NOT         MUST NOT
  1389.   Message                  SHOULD           SHOULD           SHOULD
  1390.   Client identifier        MUST NOT         MUST NOT         MUST NOT
  1391.   Class identifier         MUST NOT         MUST NOT         MUST NOT
  1392.   Server identifier        MUST             MAY              MAY
  1393.   Maximum message size     MUST NOT         MUST NOT         MUST NOT
  1394.   All others               MAY              MAY              MUST NOT
  1395.  
  1396.            Table 3:  Fields and options used by DHCP servers
  1397.  
  1398.  
  1399.  
  1400.  
  1401.  
  1402. Droms                                                          [Page 25]
  1403.  
  1404. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  1405.  
  1406.  
  1407.    As described in section 4.2, a server MAY, for administrative
  1408.    reasons, assign an address other than the one requested, or may
  1409.    refuse to allocate an address to a particular client even though free
  1410.    addresses are available.
  1411.  
  1412.    While not required for correct operation of DHCP, the server should
  1413.    not reuse the selected network address before the client responds to
  1414.    the server's DHCPOFFER message.  The server may choose to record the
  1415.    address as offered to the client.
  1416.  
  1417.    The server must also choose an expiration time for the lease, as
  1418.    follows:
  1419.  
  1420.    o IF the client has not requested a specific lease in the
  1421.      DHCPDISCOVER message and the client already has an assigned network
  1422.      address, the server returns the lease expiration time previously
  1423.      assigned to that address (note that the client must explicitly
  1424.      request a specific lease to extend the expiration time on a
  1425.      previously assigned address), ELSE
  1426.  
  1427.    o IF the client has not requested a specific lease in the
  1428.      DHCPDISCOVER message and the client does not have an assigned
  1429.      network address, the server assigns a locally configured default
  1430.      lease time, ELSE
  1431.  
  1432.    o IF the client has requested a specific lease in the DHCPDISCOVER
  1433.      message (regardless of whether the client has an assigned network
  1434.      address), the server may choose either to return the requested
  1435.      lease (if the lease is acceptable to local policy) or select
  1436.      another lease.
  1437.  
  1438.    Once the network address and lease have been determined, the server
  1439.    constructs a DHCPOFFER message with the offered configuration
  1440.    parameters.  It is important for all DHCP servers to return the same
  1441.    parameters (with the possible exception of a newly allocated network
  1442.    address) to ensure predictable host behavior regardless of the which
  1443.    server the client selects.  The configuration parameters MUST be
  1444.    selected by applying the following rules in the order given below.
  1445.    The network administrator is responsible for configuring multiple
  1446.    DHCP servers to ensure uniform responses from those servers.  The
  1447.    server MUST return to the client:
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.  
  1457.  
  1458. Droms                                                          [Page 26]
  1459.  
  1460. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  1461.  
  1462.  
  1463.    o The client's network address, as determined by the rules given
  1464.      earlier in this section, and the subnet mask for the network to
  1465.      which the client is connected,
  1466.  
  1467.    o The expiration time for the client's lease, as determined by the
  1468.      rules given earlier in this section,
  1469.  
  1470.    o Parameters requested by the client, according to the following
  1471.      rules:
  1472.  
  1473.         -- IF the server has been explicitly configured with a default
  1474.            value for the parameter, the server MUST include that value
  1475.            in an appropriate option in the 'option' field, ELSE
  1476.  
  1477.         -- IF the server recognizes the parameter as a parameter
  1478.            defined in the Host Requirements Document, the server MUST
  1479.            include the default value for that parameter as given in the
  1480.            Host Requirements Document in an appropriate option in the
  1481.            'option' field, ELSE
  1482.  
  1483.         -- The server MUST NOT return a value for that parameter,
  1484.  
  1485.    o Any parameters from the existing binding that differ from the Host
  1486.      Requirements documents defaults,
  1487.  
  1488.    o Any parameters specific to this client (as identified by
  1489.      the contents of 'chaddr' in the DHCPDISCOVER or DHCPREQUEST
  1490.      message), e.g., as configured by the network administrator,
  1491.  
  1492.    o Any parameters specific to this client's class (as identified
  1493.      by the contents of the 'class identifier' option in the
  1494.      DHCPDISCOVER or DHCPREQUEST message), e.g., as configured by
  1495.      the network administrator; the parameters MUST be identified
  1496.      by an exact match between the client's 'client class' and the
  1497.      client class identified in the server,
  1498.  
  1499.    o Parameters with non-default values on the client's subnet.
  1500.  
  1501.    The server inserts the 'xid' field from the DHCPDISCOVER message into
  1502.    the 'xid' field of the DHCPOFFER message and sends the DHCPOFFER
  1503.    message to the requesting client.
  1504.  
  1505. 4.3.2 DHCPREQUEST message
  1506.  
  1507.    A DHCPREQUEST message may come from a client responding to a
  1508.    DHCPOFFER message from a server, or from a client verifying a
  1509.    previously allocated IP address.  If the DHCPREQUEST message contains
  1510.    a 'server identifier' option, the message is in response to a
  1511.  
  1512.  
  1513.  
  1514. Droms                                                          [Page 27]
  1515.  
  1516. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  1517.  
  1518.  
  1519.    DHCPOFFER message.  Otherwise, the message is a request to renew or
  1520.    extend an existing lease.
  1521.  
  1522.    Consider first the case of a DHCPREQUEST message in response to a
  1523.    DHCPOFFER message.  If the server is identified in the 'server
  1524.    identifier' option in the DHCPREQUEST message, the server checks to
  1525.    confirm that the requested parameters are acceptable.  Usually, the
  1526.    requested parameters will match those returned to the client in the
  1527.    DHCPOFFER message; however, the client may choose to request a
  1528.    different lease duration.  Also, there is no requirement that the
  1529.    server cache the parameters from the DHCPOFFER message.  The server
  1530.    must simply check that the parameters requested in the DHCPREQUEST
  1531.    are acceptable.  If the parameters are acceptable, the server records
  1532.    the new client binding and returns a DHCPACK message to the client.
  1533.  
  1534.    If the requested parameters are unacceptable, e.g., the requested
  1535.    lease time is unacceptable to local policy, the server sends a
  1536.    DHCPNAK message to the client.  The server may choose to return an
  1537.    error message in the 'message' option.
  1538.  
  1539.    If a different server is identified in the 'server identifier' field,
  1540.    the client has selected a different server from which to obtain
  1541.    configuration parameters.  The server may discard any information it
  1542.    may have cached about the client's request, and may free the network
  1543.    address that it had offered to the client.
  1544.  
  1545.    Note that the client may choose to collect several DHCPOFFER messages
  1546.    and select the "best" offer.  The client indicates its selection by
  1547.    identifying the offering server in the DHCPREQUEST message.  If the
  1548.    client receives no acceptable offers, the client may choose to try
  1549.    another DHCPDISCOVER message.  Therefore, the servers may not receive
  1550.    a specific DHCPREQUEST from which they can decide whether or not the
  1551.    client has accepted the offer.  Because the servers have not
  1552.    committed any network address assignments on the basis of a
  1553.    DHCPOFFER, servers are free to reuse offered network addresses in
  1554.    response to subsequent requests.  As an implementation detail,
  1555.    servers should not reuse offered addresses and may use an
  1556.    implementation-specific timeout mechanism to decide when to reuse an
  1557.    offered address.
  1558.  
  1559.    In the second case, when there is no 'server identifier' option, the
  1560.    client is renewing or extending a previously allocated IP address.
  1561.    The server checks to confirm that the requested parameters are
  1562.    acceptable.  If the parameters specified in the DHCPREQUEST message
  1563.    match the previous parameters, or if the request for an extension of
  1564.    the lease (indicated by an extended 'IP address lease time' option)
  1565.    is acceptable, the server returns a DHCPACK message to the requesting
  1566.    client.  Otherwise, the server returns a DHCPNAK message to the
  1567.  
  1568.  
  1569.  
  1570. Droms                                                          [Page 28]
  1571.  
  1572. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  1573.  
  1574.  
  1575.    client.  In particular, if the previously allocated network address
  1576.    in the 'ciaddr' field from the client does not match the network
  1577.    address recorded by the server for that client, the server sends a
  1578.    DHCPNAK to the client.
  1579.  
  1580.    A DHCP server chooses the parameters to return in a DHCPACK message
  1581.    according to the same rules as used in constructing a DHCPOFFER
  1582.    message, as given in section 4.3.1.
  1583.  
  1584. 4.3.3 DHCPDECLINE message
  1585.  
  1586.    If the server receives a DHCPDECLINE message, the client has
  1587.    discovered through some other means that the suggested network
  1588.    address is already in use.  The server MUST mark the network address
  1589.    as not allocated and SHOULD notify the local system administrator of
  1590.    a possible configuration problem.
  1591.  
  1592. 4.3.4 DHCPRELEASE message
  1593.  
  1594.    Upon receipt of a DHCPRELEASE message, the server marks the network
  1595.    address as not allocated.  The server should retain a record of the
  1596.    client's initialization parameters for possible reuse in response to
  1597.    subsequent requests from the client.
  1598.  
  1599. 4.4 DHCP client behavior
  1600.  
  1601.    Figure 5 gives a state-transition diagram for a DHCP client.  A
  1602.    client can receive the following messages from a server:
  1603.  
  1604.       o DHCPOFFER
  1605.  
  1606.       o DHCPACK
  1607.  
  1608.       o DHCPNAK
  1609.  
  1610.    Table 4 gives the use of the fields and options in a DHCP message by
  1611.    a client.  The remainder of this section describes the action of the
  1612.    DHCP client for each possible incoming message.  The description in
  1613.    the following section corresponds to the full configuration procedure
  1614.    previously described in section 3.1, and the text in the subsequent
  1615.    section corresponds to the abbreviated configuration procedure
  1616.    described in section 3.2.
  1617.  
  1618. 4.4.1 Initialization and allocation of network address
  1619.  
  1620.    The client begins in INIT state and forms a DHCPDISCOVER message.
  1621.    The client should wait a random time between one and ten seconds to
  1622.    desynchronize the use of DHCP at startup.  The client sets 'ciaddr'
  1623.  
  1624.  
  1625.  
  1626. Droms                                                          [Page 29]
  1627.  
  1628. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  1629.  
  1630.  
  1631.    to 0x00000000.  The client MAY request specific parameters by
  1632.    including the 'parameter request list' option.  The client MAY
  1633.    suggest a network address and/or lease time by including the
  1634.    'requested IP address' and 'IP address lease time' options.  The
  1635.    client MUST include its hardware address in the 'chaddr' field for
  1636.    use in delivery of DHCP reply messages.  The client MAY include a
  1637.    different unique identifier in the 'client identifier' option.  If
  1638.    the client does not include the 'client identifier' option, the
  1639.    server will use the contents of the 'chaddr' field to identify the
  1640.    client's lease.
  1641.  
  1642.    The client generates and records a random transaction identifier and
  1643.    inserts that identifier into the 'xid' field.  The client records its
  1644.    own local time for later use in computing the lease expiration.  The
  1645.    client then broadcasts the DHCPDISCOVER on the local hardware
  1646.    broadcast address to 0xffffffff IP broadcast address and 'DHCP
  1647.    server' UDP port.
  1648.  
  1649.    If the 'xid' of an arriving DHCPOFFER message does not match the
  1650.    'xid' of the most recent DHCPDISCOVER message, the DHCPOFFER message
  1651.    must be silently discarded.  Any arriving DHCPACK messages must be
  1652.    silently discarded.
  1653.  
  1654.    The client collects DHCPOFFER messages over a period of time, selects
  1655.    one DHCPOFFER message from the (possibly many) incoming DHCPOFFER
  1656.    messages (e.g., the first DHCPOFFER message or the DHCPOFFER message
  1657.    from the previously used server) and extracts the server address from
  1658.    the 'server identifier' option in the DHCPOFFER message.  The time
  1659.    over which the client collects messages and the mechanism used to
  1660.    select one DHCPOFFER are implementation dependent.  The client may
  1661.    perform a check on the suggested address to ensure that the address
  1662.    is not already in use.  For example, if the client is on a network
  1663.    that supports ARP, the client may issue an ARP request for the
  1664.    suggested request.  When broadcasting an ARP request for the
  1665.    suggested address, the client must fill in its own hardware address
  1666.    as the sender's hardware address, and 0 as the sender's IP address,
  1667.    to avoid confusing ARP caches in other hosts on the same subnet.  If
  1668.    the network address appears to be in use, the client sends a
  1669.    DHCPDECLINE message to the server and waits for another DHCPOFFER. As
  1670.    the client does not have a valid network address, the client must
  1671.    broadcast the DHCPDECLINE message.
  1672.  
  1673.  
  1674.  
  1675.  
  1676.  
  1677.  
  1678.  
  1679.  
  1680.  
  1681.  
  1682. Droms                                                          [Page 30]
  1683.  
  1684. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  1685.  
  1686.  
  1687.  --------                               -------
  1688. |        | +-------------------------->|       |<-------------------+
  1689. | INIT/  | |     +-------------------->| INIT  |                    |
  1690. | REBOOT |DHCPNAK/         +---------->|       |<---+               |
  1691. |        |Restart|         |            -------     |               |
  1692.  --------  |  DHCPNAK/     |               |                        |
  1693.     |      Discard offer   |      -/Send DHCPDISCOVER               |
  1694. -/Send DHCPREQUEST         |               |                        |
  1695.     |      |     |      DHCPACK            v        |               |
  1696.  -----------     |   (not accept.)/   -----------   |               |
  1697. |           |    |  Send DHCPDECLINE |           |  |               |
  1698. | REBOOTING |    |         |         | SELECTING |  |               |
  1699. |           |    |        /          |           |  |               |
  1700.  -----------     |       /            -----------   |               |
  1701.     |            |      /                  |        |               |
  1702. DHCPACK/         |     /  +----------------+        |               |
  1703. Record lease,    |    |   v                         |               |
  1704. set timers      ------------                        |               |
  1705.     |   +----->|            |             DHCPNAK, Lease expired/   |
  1706.     |   |      | REQUESTING |                  Halt network         |
  1707.     DHCPOFFER/ |            |                       |               |
  1708.     Discard     ------------                        |               |
  1709.     |   |        |        |                   -----------           |
  1710.     |   +--------+     DHCPACK/              |           |          |
  1711.     |              Record lease, set    -----| REBINDING |          |
  1712.     |                timers T1, T2     /     |           |          |
  1713.     |                     |        DHCPACK/   -----------           |
  1714.     |                     v     Record lease, set   ^               |
  1715.     +----------------> -------      /Timers T1,T2   |               |
  1716.                +----->|       |<---+                |               |
  1717.                |      | BOUND |<---+                |               |
  1718.   DHCPOFFER, DHCPACK, |       |    |            T2 expires/   DHCPNAK/
  1719.    DHCPNAK/Discard     -------     |             Broadcast  Halt network
  1720.                |       | |         |            DHCPREQUEST         |
  1721.                +-------+ |        DHCPACK/          |               |
  1722.                     T1 expires/   Record lease, set |               |
  1723.                  Send DHCPREQUEST timers T1, T2     |               |
  1724.                  to leasing server |                |               |
  1725.                          |   ----------             |               |
  1726.                          |  |          |------------+               |
  1727.                          +->| RENEWING |                            |
  1728.                             |          |----------------------------+
  1729.                              ----------
  1730.  
  1731.           Figure 5:  State-transition diagram for DHCP clients
  1732.  
  1733.  
  1734.  
  1735.  
  1736.  
  1737.  
  1738. Droms                                                          [Page 31]
  1739.  
  1740. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  1741.  
  1742.  
  1743.   Field      DHCPDISCOVER          DHCPREQUEST           DHCPDECLINE,
  1744.                                                          DHCPRELEASE
  1745.   -----      ------------          -----------           -----------
  1746.  
  1747.   'op'       BOOTREQUEST           BOOTREQUEST           BOOTREQUEST
  1748.   'htype'    (From "Assigned Numbers" RFC)
  1749.   'hlen'     (Hardware address length in octets)
  1750.   'hops'     0                     0                     0
  1751.   'xid'      selected by client    selected by client    selected by
  1752.                                                          client
  1753.   'secs'     (opt.)                (opt.)                0
  1754.   'flags'    Set 'BROADCAST'       Set 'BROADCAST'
  1755.              flag if client        flag if client
  1756.              requires broadcast    requires broadcast
  1757.              reply                 reply
  1758.              0
  1759.   'ciaddr'   0                     previously            ciaddr
  1760.                                    allocated newtork
  1761.                                    address
  1762.   'yiaddr'   0                     0                     0
  1763.   'siaddr'   0                     0                     0
  1764.   'giaddr'   0                     0                     0
  1765.   'chaddr'   client's hardware     client's hardware     client's
  1766.                                                          hardware
  1767.              address               address               address
  1768.   'sname'    options, if           options, if           (unused)
  1769.              indicated in          indicated in
  1770.              'sname/file'          'sname/file'
  1771.              option; otherwise     option; otherwise
  1772.              unused                unused
  1773.   'file'     options, if           options, if           (unused)
  1774.              indicated in          indicated in
  1775.              'sname/file'          'sname/file'
  1776.              option; otherwise     option; otherwise
  1777.              'generic' name or     'generic' name or
  1778.              null                  null
  1779.   'options'  options               options               (unused)
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.  
  1787.  
  1788.  
  1789.  
  1790.  
  1791.  
  1792.  
  1793.  
  1794. Droms                                                          [Page 32]
  1795.  
  1796. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  1797.  
  1798.  
  1799.   Option                     DHCPDISCOVER  DHCPREQUEST      DHCPDECLINE,
  1800.                                                             DHCPRELEASE
  1801.   ------                     ------------  -----------      -----------
  1802.  
  1803.   Requested IP address       MAY           MUST NOT         MUST NOT
  1804.   IP address lease time      MAY           MAY              MUST NOT
  1805.   Use 'file'/'sname' fields  MAY           MAY              MAY
  1806.   DHCP message type          DHCPDISCOVER  DHCPREQUEST      DHCPDECLINE/
  1807.                                                             DHCPRELEASE
  1808.   Client identifier          MAY           MAY              MAY
  1809.   Class identifier           SHOULD        SHOULD           MUST NOT
  1810.   Server identifier          MUST NOT      MUST (after      MUST
  1811.                                            DHCPDISCOVER),
  1812.                                            MUST NOT (when
  1813.                                            renewing)
  1814.   Parameter request list     MAY           MAY              MUST NOT
  1815.   Maximum message size       MAY           MAY              MUST NOT
  1816.   Message                    SHOULD NOT    SHOULD NOT       SHOULD
  1817.   Site-specific              MAY           MAY              MUST NOT
  1818.   All others                 MUST NOT      MUST NOT         MUST NOT
  1819.  
  1820.            Table 4:  Fields and options used by DHCP clients
  1821.  
  1822.    If the parameters are acceptable, the client records the address of
  1823.    the server that supplied the parameters from the 'server identifier'
  1824.    field and sends that address in the 'server identifier' field of a
  1825.    DHCPREQUEST broadcast message.  Once the DHCPACK message from the
  1826.    server arrives, the client is initialized and moves to BOUND state.
  1827.    The DHCPREQUEST message contains the same 'xid' as the DHCPOFFER
  1828.    message.  The client records the lease expiration time as the sum of
  1829.    the time at which the original request was sent and the duration of
  1830.    the lease from the DHCPOFFER message.  The client SHOULD broadcast an
  1831.    ARP reply to announce the client's new IP address and clear any
  1832.    outdated ARP cache entries in hosts on the client's subnet.
  1833.  
  1834. 4.4.2 Initialization with known network address
  1835.  
  1836.    The client begins in INIT-REBOOT state and sends a DHCPREQUEST message
  1837.    with the 'ciaddr' field set to the client's network address.  The
  1838.    client may request specific configuration parameters by including
  1839.    the 'parameter request list' option.  The client generates and records a
  1840.    random transaction identifier and inserts that identifier into the 'xid'
  1841.    field.  The client records its own local time for later use in
  1842.    computing the lease expiration.  The client MUST NOT incldue a 'server
  1843.    identifier' in the DHCPREQUEST message.  The client then broadcasts
  1844.    the DHCPREQUEST on the local hardware broadcast address to the 'DHCP
  1845.    server' UDP port.
  1846.  
  1847.  
  1848.  
  1849.  
  1850. Droms                                                          [Page 33]
  1851.  
  1852. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  1853.  
  1854.  
  1855.    Once a DHCPACK message with an 'xid' field matching that in the
  1856.    client's DHCPREQUEST message arrives from any server, the client is
  1857.    initialized and moves to BOUND state.  The client records the lease
  1858.    expiration time as the sum of the time at which the DHCPREQUEST
  1859.    message was sent and the duration of the lease from the DHCPACK
  1860.    message.
  1861.  
  1862. 4.4.3 Initialization with a known DHCP server address
  1863.  
  1864.    When the DHCP client knows the address of a DHCP server, in either
  1865.    INIT or REBOOTING state, the client may use that address in the
  1866.    DHCPDISCOVER or DHCPREQUEST rather than the IP broadcast address.  If
  1867.    the client receives no response to DHCP messages sent to the IP
  1868.    address of a known DHCP server, the DHCP client reverts to using the
  1869.    IP broadcast address.
  1870.  
  1871. 4.4.4 Reacquisition and expiration
  1872.  
  1873.    The client maintains two times, T1 and T2, that specify the times at
  1874.    which the client tries to extend its lease on its network address.  T1
  1875.    is the time at which the client enters the RENEWING state and attempts
  1876.    to contact the server that originally issued the client's network
  1877.    address.  T2 is the time at which the client enters the REBINDING
  1878.    state and attempts to contact any server.
  1879.  
  1880.    At time T1 after the client accepts the lease on its network address,
  1881.    the client moves to RENEWING state and sends (via unicast) a
  1882.    DHCPREQUEST message to the server to extend its lease.  The client
  1883.    generates a random transaction identifier and inserts that identifier
  1884.    into the 'xid' field in the DHCPREQUEST. The client records the local
  1885.    time at which the DHCPREQUEST message is sent for computation of the
  1886.    lease expiration time.  The client MUST NOT include a 'server
  1887.    identifier' in the DHCPREQUEST message.
  1888.  
  1889.    Any DHCPACK messages that arrive with an 'xid' that does not match
  1890.    the 'xid' of the client's DHCPREQUEST message are silently discarded.
  1891.    When the client receives a DHCPACK from the server, the client
  1892.    computes the lease expiration time as the sum of the time at which the
  1893.    client sent the DHCPREQUEST message and the duration of the lease in
  1894.    the DHCPACK message.  The client has successfully reacquired its
  1895.    network address, returns to BOUND state and may continue network
  1896.    processing.
  1897.  
  1898.    If no DHCPACK arrives before time T2 (T2 > T1) before the expiration
  1899.    of the client's lease on its network address, the client moves to
  1900.    REBINDING state and sends (via broadcast) a DHCPREQUEST message to
  1901.    extend its lease.  The client sets the 'ciaddr' field in the
  1902.    DHCPREQUEST to its current network address.  The client MUST NOT
  1903.  
  1904.  
  1905.  
  1906. Droms                                                          [Page 34]
  1907.  
  1908. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  1909.  
  1910.  
  1911.    include a 'server identifier' in the DHCPREQUEST message.
  1912.  
  1913.    Times T1 and T2 are configurable by the server through options.  T1
  1914.    defaults to (0.5 * duration_of_lease).  T2 defaults to (0.875 *
  1915.    duration_of_lease).  Times T1 and T2 should be chosen with some random
  1916.    "fuzz" around a fixed value, to avoid synchronization of client
  1917.    reacquisition.
  1918.  
  1919.    In both RENEWING and REBINDING state, if the client receives no
  1920.    response to its DHCPREQUEST message, the client should wait one-half
  1921.    the remaining time until the expiration of T1 (in RENEWING state) and
  1922.    T2 (in REBINDING state) down to a minimum of 60 seconds, before
  1923.    retransmitting the DHCPREQUEST message.
  1924.  
  1925.    If the lease expires before the client receives a DHCPACK, the client
  1926.    moves to INIT state, MUST immediately stop any other network
  1927.    processing and requests network initialization parameters as if the
  1928.    client were uninitialized.  If the client then receives a DHCPACK
  1929.    allocating that client its previous network address, the client SHOULD
  1930.    continue network processing.  If the client is given a new network
  1931.    address, it MUST NOT continue using the previous network address and
  1932.    SHOULD notify the local users of the problem.
  1933.  
  1934. 4.4.5 DHCPRELEASE
  1935.  
  1936.    If the client no longer requires use of its assigned network address
  1937.    (e.g., the client is gracefully shut down), the client sends a
  1938.    DHCPRELEASE message to the server.  Note that the correct operation of
  1939.    DHCP does not depend on the transmission of DHCPRELEASE messages.
  1940.  
  1941. 5. Acknowledgments
  1942.  
  1943.    Greg Minshall, Leo McLaughlin and John Veizades have patiently
  1944.    contributed to the the design of DHCP through innumerable discussions,
  1945.    meetings and mail conversations.  Jeff Mogul first proposed the
  1946.    client-server based model for DHCP.  Steve Deering searched the
  1947.    various IP RFCs to put together the list of network parameters
  1948.    supplied by DHCP.  Walt Wimer contributed a wealth of practical
  1949.    experience with BOOTP and wrote a document clarifying the behavior of
  1950.    BOOTP/DHCP relay agents.  Jesse Walker analyzed DHCP in detail,
  1951.    pointing out several inconsistencies in earlier specifications of the
  1952.    protocol.  Steve Alexander reviewed Walker's analysis and the fixes to
  1953.    the protocol based on Walker's work.  And, of course, all the members
  1954.    of the Dynamic Host Configuration Working Group of the IETF have
  1955.    contributed to the design of the protocol through discussion and
  1956.    review of the protocol design.
  1957.  
  1958.  
  1959.  
  1960.  
  1961.  
  1962. Droms                                                          [Page 35]
  1963.  
  1964. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  1965.  
  1966.  
  1967. 6. References
  1968.  
  1969.    [1] Acetta, M., "Resource Location Protocol", RFC 887, CMU, December
  1970.        1983.
  1971.  
  1972.    [2] Alexander, S., and R. Droms, "DHCP Options and BOOTP Vendor
  1973.        Extensions", RFC 1533, Lachman Technology, Inc., Bucknell
  1974.        University, October 1993.
  1975.  
  1976.    [3] Braden, R., Editor, "Requirements for Internet Hosts --
  1977.        Communication Layers", STD 3, RFC 1122, USC/Information Sciences
  1978.        Institute, October 1989.
  1979.  
  1980.    [4] Braden, R., Editor, "Requirements for Internet Hosts --
  1981.        Application and Support, STD 3, RFC 1123, USC/Information
  1982.        Sciences Institute, October 1989.
  1983.  
  1984.    [5] Brownell, D, "Dynamic Reverse Address Resolution Protocol
  1985.        (DRARP)", Work in Progress.
  1986.  
  1987.    [6] Comer, D., and R. Droms, "Uniform Access to Internet Directory
  1988.        Services", Proc. of ACM SIGCOMM '90 (Special issue of Computer
  1989.        Communications Review), 20(4):50--59, 1990.
  1990.  
  1991.    [7] Croft, B., and J. Gilmore, "Bootstrap Protocol (BOOTP)", RFC 951,
  1992.        Stanford and SUN Microsystems, September 1985.
  1993.  
  1994.    [8] Deering, S., "ICMP Router Discovery Messages", RFC 1256, Xerox
  1995.        PARC, September 1991.
  1996.  
  1997.    [9] Droms, D., "Interoperation between DHCP an BOOTP" RFC 1534,
  1998.        Bucknell University, October 1993.
  1999.  
  2000.   [10] Finlayson, R., Mann, T., Mogul, J., and M. Theimer, "A Reverse
  2001.        Address Resolution Protocol", RFC 903, Stanford, June 1984.
  2002.  
  2003.   [11] Gray C., and D. Cheriton, "Leases: An Efficient Fault-Tolerant
  2004.        Mechanism for Distributed File Cache Consistency", In Proc. of
  2005.        the Twelfth ACM Symposium on Operating Systems Design, 1989.
  2006.  
  2007.   [12] Mockapetris, P., "Domain Names -- Concepts and Facilities", STD
  2008.        13, RFC 1034, USC/Information Sciences Institute, November 1987.
  2009.  
  2010.   [13] Mockapetris, P., "Domain Names -- Implementation and
  2011.        Specification", STD 13, RFC 1035, USC/Information Sciences
  2012.        Institute, November 1987.
  2013.  
  2014.  
  2015.  
  2016.  
  2017.  
  2018. Droms                                                          [Page 36]
  2019.  
  2020. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  2021.  
  2022.  
  2023.   [14] Mogul J., and S. Deering, "Path MTU Discovery", RFC 1191,
  2024.        November 1990.
  2025.  
  2026.   [15] Morgan, R., "Dynamic IP Address Assignment for Ethernet Attached
  2027.        Hosts", Work in Progress.
  2028.  
  2029.   [16] Postel, J., "Internet Control Message Protocol", STD 5, RFC 792,
  2030.        USC/Information Sciences Institute, September 1981.
  2031.  
  2032.   [17] Reynolds, J., "BOOTP Vendor Information Extensions", RFC 1497,
  2033.        USC/Information Sciences Institute, August 1993.
  2034.  
  2035.   [18] Reynolds, J., and J. Postel, "Assigned Numbers", STD 2, RFC 1340,
  2036.        USC/Information Sciences Institute, July 1992.
  2037.  
  2038.   [19] Jeffrey Schiller and Mark Rosenstein. A Protocol for the Dynamic
  2039.        Assignment of IP Addresses for use on an Ethernet. (Available
  2040.        from the Athena Project, MIT), 1989.
  2041.  
  2042.   [20] Sollins, K., "The TFTP Protocol (Revision 2)",  RFC 783, NIC,
  2043.        June 1981.
  2044.  
  2045.   [21] Wimer, W., "Clarifications and Extensions for the Bootstrap
  2046.        Protocol", RFC 1542, Carnegie Mellon University, October 1993.
  2047.  
  2048. 7. Security Considerations
  2049.  
  2050.    DHCP is built directly on UDP and IP which are as yet inherently
  2051.    insecure.  Furthermore, DHCP is generally intended to make
  2052.    maintenance of remote and/or diskless hosts easier.  While perhaps
  2053.    not impossible, configuring such hosts with passwords or keys may be
  2054.    difficult and inconvenient.  Therefore, DHCP in its current form is
  2055.    quite insecure.
  2056.  
  2057.    Unauthorized DHCP servers may be easily set up.  Such servers can
  2058.    then send false and potentially disruptive information to clients
  2059.    such as incorrect or duplicate IP addresses, incorrect routing
  2060.    information (including spoof routers, etc.), incorrect domain
  2061.    nameserver addresses (such as spoof nameservers), and so on.
  2062.    Clearly, once this seed information is in place, an attacker can
  2063.    further compromise affected systems.
  2064.  
  2065.    Malicious DHCP clients could masquerade as legitimate clients and
  2066.    retrieve information intended for those legitimate clients.  Where
  2067.    dynamic allocation of resources is used, a malicious client could
  2068.    claim all resources for itself, thereby denying resources to
  2069.    legitimate clients.
  2070.  
  2071.  
  2072.  
  2073.  
  2074. Droms                                                          [Page 37]
  2075.  
  2076. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  2077.  
  2078.  
  2079. 8. Author's Address
  2080.  
  2081.    Ralph Droms
  2082.    Computer Science Department
  2083.    323 Dana Engineering
  2084.    Bucknell University
  2085.    Lewisburg, PA 17837
  2086.  
  2087.    Phone: (717) 524-1145
  2088.    EMail: droms@bucknell.edu
  2089.  
  2090.  
  2091.  
  2092.  
  2093.  
  2094.  
  2095.  
  2096.  
  2097.  
  2098.  
  2099.  
  2100.  
  2101.  
  2102.  
  2103.  
  2104.  
  2105.  
  2106.  
  2107.  
  2108.  
  2109.  
  2110.  
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116.  
  2117.  
  2118.  
  2119.  
  2120.  
  2121.  
  2122.  
  2123.  
  2124.  
  2125.  
  2126.  
  2127.  
  2128.  
  2129.  
  2130. Droms                                                          [Page 38]
  2131.  
  2132. RFC 1541          Dynamic Host Configuration Protocol       October 1993
  2133.  
  2134.  
  2135. A. Host Configuration Parameters
  2136.  
  2137.    IP-layer_parameters,_per_host:_
  2138.  
  2139.    Be a router                     on/off                 HRC 3.1
  2140.    Non-local source routing        on/off                 HRC 3.3.5
  2141.    Policy filters for
  2142.    non-local source routing        (list)                 HRC 3.3.5
  2143.    Maximum reassembly size         integer                HRC 3.3.2
  2144.    Default TTL                     integer                HRC 3.2.1.7
  2145.    PMTU aging timeout              integer                MTU 6.6
  2146.    MTU plateau table               (list)                 MTU 7
  2147.    IP-layer_parameters,_per_interface:_
  2148.    IP address                      (address)              HRC 3.3.1.6
  2149.    Subnet mask                     (address mask)         HRC 3.3.1.6
  2150.    MTU                             integer                HRC 3.3.3
  2151.    All-subnets-MTU                 on/off                 HRC 3.3.3
  2152.    Broadcast address flavor        0x00000000/0xffffffff  HRC 3.3.6
  2153.    Perform mask discovery          on/off                 HRC 3.2.2.9
  2154.    Be a mask supplier              on/off                 HRC 3.2.2.9
  2155.    Perform router discovery        on/off                 RD 5.1
  2156.    Router solicitation address     (address)              RD 5.1
  2157.    Default routers, list of:
  2158.           router address          (address)              HRC 3.3.1.6
  2159.           preference level        integer                HRC 3.3.1.6
  2160.    Static routes, list of:
  2161.           destination             (host/subnet/net)      HRC 3.3.1.2
  2162.           destination mask        (address mask)         HRC 3.3.1.2
  2163.           type-of-service         integer                HRC 3.3.1.2
  2164.           first-hop router        (address)              HRC 3.3.1.2
  2165.           ignore redirects        on/off                 HRC 3.3.1.2
  2166.           PMTU                    integer                MTU 6.6
  2167.           perform PMTU discovery  on/off                 MTU 6.6
  2168.  
  2169.    Link-layer_parameters,_per_interface:_
  2170.    Trailers                       on/off                 HRC 2.3.1
  2171.    ARP cache timeout              integer                HRC 2.3.2.1
  2172.    Ethernet encapsulation         (RFC 894/RFC 1042)     HRC 2.3.3
  2173.  
  2174.    TCP_parameters,_per_host:_
  2175.    TTL                            integer                HRC 4.2.2.19
  2176.    Keep-alive interval            integer                HRC 4.2.3.6
  2177.    Keep-alive data size           0/1                    HRC 4.2.3.6
  2178.  
  2179. Key:
  2180.  
  2181.    MTU = Path MTU Discovery (RFC 1191, Proposed Standard)
  2182.    RD = Router Discovery (RFC 1256, Proposed Standard)
  2183.  
  2184.  
  2185.  
  2186. Droms                                                          [Page 39]
  2187.